#ifndef GAMEKIT_GAME_H
#define GAMEKIT_GAME_H

#include <string>

#include "common/SafePointer.h"
#include "common/AutoPointer.h"
#include "common/EventSource.h"
#include "gamekit.h"

#include "Window.h"

namespace gamekit
{
	class Scene;

	class GK_API Game
	{
	public:
		Game(const std::string& title, const ushort& width, const ushort& height, const uint& depth);
		~Game();

		SafePointer<Scene> scene(void) const;
		SafePointer<Window> window(void) const;

		void init(void);
		void loop(void);
		void quit(void);

	private:
		uint elapsed(void);
		void processEvents(void);

	private:
		AutoPointer<Window> m_window;
		AutoPointer<Scene> m_scene;
		bool m_run;
		uint m_previousTicks;

		void onQuit(const EventArgs<Window, WindowEvents, weQuit>& args);
	};
}

#endif
